/**
 * @author David Milne
 */

function Tab() {
	
	this.tabPane ;
	this.id ;
}

Tab.prototype.init = tab_init ;

function tab_init(id, content, tabPane) {
	try {
		this.tabPane = tabPane ;
		this.id = id ;
		
		this.className = "tab_deselected" ;
				
		this.innerHTML = content + "&nbsp;&nbsp<span></span>" ;
    	this.onclick = new Function("getTabPane(" + tabPane.num + ").selectTab(\"" + id + "\") ;") ;
		
		if (tabPane.canClose == true && tabPane.tabWidth != null) {
			
			var mask = document.createElement("div") ;
			mask.className = "mask" ;
			mask.style.left = tabPane.tabWidth - 29 + "px" ;
			this.appendChild(mask) ;
			
			var closeTab = document.createElement("div") ;
			closeTab.className = "closeTab" ;
			closeTab.style.left = tabPane.tabWidth - 25 + "px" ;
			closeTab.onclick = Function("getTabPane(" + tabPane.num + ").removeTab(\"" + id + "\") ;") ;
			this.appendChild(closeTab) ;
		}
		
		if (tabPane.tabWidth != null) 
			this.style.width = tabPane.tabWidth - 8 + "px" ;
		
	} catch ( e ) { 
		logError("tab.init.error: " + e ); 
		throw (e) ;
	}
} 